<?php
/**
 *    Copyright 2010 Show Framework(www.showframework.cn)
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 * 
 *        http://www.apache.org/licenses/LICENSE-2.0
 * 
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 * 
 * @copyright  Copyright (c) 2009-2010 Show Framework. (http://www.showframework.com)
 * @license    http://www.apache.org/licenses/LICENSE-2.0     Apache License 2.0
 */

/**
 * 缓存功能接口
 *
 * @package Show_Cache
 * @name    Show_Cache_Interface
 * @author  show
 * @since   v0.6
 */
interface Show_Cache_Interface
{
    /**
     * 设置当前缓存对象的缓存有效期，覆盖之前的设置
     *
     * @param int|false $newLifetimes 新有效期，以秒计算 false为永久有效
     * @return void
     */
    public function setLifetime($newLifetime);
    
    /**
     * 用当前缓存对象保存一些数据
     *
     * @param mixed $data 被缓存的数据
     * @param int $lifetime 缓存有效期，不设置为永久有效
     * @return bool 成功返回true，失败返回false
     */
    public function save($data, $lifetime = false);
    
    /**
     * 加载已缓存的数据
     *
     * @return mixed|null 成功返回缓存的数据，失败返回null
     */
    public function load();
    
    /**
     * 移除当前缓存对象
     * 
     * @return void
     */
    public function remove();
}
?>